import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

// 定义路由
const routes = [{
		path: '/home',
		name: 'home',
		component: Home,
	},
	{
		path: "/scan",
		component: () => import("../views/Scan.vue")
	},
	{
		path: "/scan02",
		component: () => import("../views/Scan02.vue")
	},
	{
		path: "/scan03",
		component: () => import("../views/Scan03.vue")
	},
	{
		path: "/datatable",
		name: 'datatable',
		component: () => import("../views/DataTable.vue")
	},
	{
		path: "/table",
		name: 'table',
		component: () => import("../views/Table.vue"),
		// props:true  // 如果props设置为true，$route.params将被设置为组件属性  
	},
	{
		path: "/list",
		name: 'list',
		component: () => import("../views/BomList.vue"),
	},
	{
		path: "/",
		redirect: "/table" //默认显示首页
	},
	{
		path: "/test/table",
		name: 'table',
		component: () => import("../views/test/Table2.vue"),
	}
]


//   创建 router 实例，然后传 `routes` 配置
const router = new VueRouter({
	mode: "hash",
	routes // 当键和值同名时，可以简写，等同于 `routes: routes`
})
export default router // 导出
